import Vue from 'vue'
import VueRouter from 'vue-router'
import _import from './_import'
import Admin from './routes/admin'

const Pages = _import('pages')

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Login',
    component: Pages('login/index')
  },
  {
    path: '/admin',
    name: 'Admin',
    component: Pages('admin/index'),
    children: [].concat(Admin)
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
